home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
PowerPlant
/
AGA Classes 1.2
/
RadioButton
/
LAGARadioButton.h
< prev
Wrap
Text File
|
1996-06-30
|
7KB
|
139 lines
// ===========================================================================
// LAGARadioButton.h
// ===========================================================================
// “Apple Grayscale Appearance” compliant Radio Button
// Copyright © 1996 Chrisoft (Christophe ANDRES) All rights reserved.
//
// You may use this source code in any application (commercial, shareware, freeware,
// postcardware, etc), but not remove this notice (no need to acknowledge the use of
// this class in the about box)
// You may not sell this source code in any form. This source code may be placed on
// publicly accessable archive sites and source code disks. It may not be placed on
// profit archive sites and source code disks without the permission of the author,
// Christophe ANDRES.
//
// This source code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// If you make any change or improvement on this class, please send the improved/changed
// version to : chrisoft@calva.net or Christophe ANDRES
// 20, rue Prosper Mérimée
// 67100 STRASBOURG
// FRANCE
//
// ===========================================================================
// LAGARadioButton.cp <- double-click + Command-D to see class implementation
//
// LAGARadioButton is my implementation of the “Apple Grayscale Appearance for System 7.5”
// Radio Buttons
//
// This class requires AGAColors.cp to be present in your project
//
// Version : 1.2
//
// Change History (most recent first, date in US form : mm/dd/yy):
//
// 06/30/96 ca Public release of version 1.2
// 06/28/96 ca Added DisableSelf and EnableSelf methods
// 06/04/96 ca made CW9 adjustments
// Added guard macros in header files
// Increased version to 1.2
// 05/25/96 ca Relinquish memory used by the static PixMapHandle if no radio button is used anymore
// 05/23/96 ca Updated the below changes (M™H) to allow the usage of either the standard radio button template
// or the custom LAGARadioButton template. The standard radio button template is easier for layout
// because you can see the text, but you cannot define directly a mixed value radio button
// Defined class_ID1 and CreateAGARadioButtonStream1 to handle the two template possibilities
// Added a CPPb to "LAGARadioButton CPPb.rsrc" called LAGARadioButton1 to handle the standard
// radio button template, without having to tinker the class ID
// Added a static RegisterClass method to simplify the class registration
// 05/23/96 M™H Changed the stream constructor to use the standard radio button template in Contructor
// which enables to see the text put in a radio button while defining the view
// 05/16/96 ca Increased version to 1.1
// Added copy constructor
// Added "on the fly" constructor
// Added GetDescriptor and SetDescriptor
// Added SetTextTraitsID and GetTextTraitsID
// Added change history
// 05/15/96 M™H changes proposed by Michael(tm) Hamel <mhamel@adi.co.nz> (Thanks a lot ;)
// use a static PixMapHandle for FASTER draw of the button (uses less code too)
// Note : the previous drawing method is available conditionnaly by defining SLOW_AGA_RADIO_DRAW
// which uses more code, but less data (we never know who could need this ;)
// To compare speed, with M™H's method, drawing 135 radio buttons on a 9500/120
// takes around 0s20 and with the SLOW_AGA_RADIO_DRAW method, the same takes around 1s70
// 04/22/96 ca class made available by Christophe ANDRES <chrisoft@calva.net>
// (version 1.0)
//
// To Do:
//
#ifndef _H_LAGARadioButton
#define _H_LAGARadioButton
#pragma once
#undef SLOW_AGA_RADIO_DRAW // define this symbol to use the “slow” drawing method (more code, but less data generated)
#define AGA_USE_STD_RADIOCPPB // undefine this symbol to use the 1.0 CPPb instead of the standard Radio button PPob definition
#include <LControl.h>
#include <LString.h>
class LAGARadioButton : public LControl
{
public :
enum { class_ID = 'AGA2', class_ID1 = 'AgA2' }; // begin <05/23/96 ca>
static void RegisterClass ();
static LAGARadioButton* CreateAGARadioButtonStream (LStream *inStream);
static LAGARadioButton* CreateAGARadioButtonStream1 (LStream *inStream); // end <05/23/96 ca>
LAGARadioButton ();
LAGARadioButton (LStream *inStream, Boolean inCreateWithRadioButton = false); // <05/23/96 ca>
LAGARadioButton (const LAGARadioButton &inOriginal); // <05/16/96 ca>
LAGARadioButton (const SPaneInfo &inPaneInfo, MessageT inValueMessage, Int32 inValue, // <05/16/96 ca>
ResIDT inTextTraitsID,Str255 inTitle);
virtual ~LAGARadioButton ();
virtual void SetValue (Int32 inValue);
virtual StringPtr GetDescriptor (Str255 outDescriptor) const; // <05/16/96 ca>
virtual void SetDescriptor (ConstStringPtr inDescriptor); // <05/16/96 ca>
virtual void SetTextTraitsID (ResIDT inTextTraitsID) { mTextTraitsID = inTextTraitsID; Refresh(); };// <05/16/96 ca>
virtual ResIDT GetTextTraitsID () { return(mTextTraitsID); }; // <05/16/96 ca>
protected :
virtual void DrawSelf ();
virtual void DrawGraphic (Boolean inPushed = false);
virtual void DrawText ();
virtual void HotSpotAction (Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside);
virtual void HotSpotResult (Int16 inHotSpot);
virtual void DisableSelf () { Refresh(); }; // <06/28/96 ca>
virtual void EnableSelf () { Refresh(); }; // <06/28/96 ca>
LStr255 mTitle;
ResIDT mTextTraitsID;
#ifndef SLOW_AGA_RADIO_DRAW
private :
static void Initialise(); // <05/15/96 M™H>
static char mDraw[9][12][12];
static PixMapHandle mImages; // <05/15/96 M™H>
static RgnHandle mRadioClip; // <05/15/96 M™H>
static long mUsage; // <05/25/96 ca>
#endif /*!SLOW_AGA_RADIO_DRAW*/
};
#endif